var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
    })(t, e);
}, function(t, e) {
    function p() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (p.prototype = e.prototype, 
    new p());
}), a = this && this.__decorate || function(t, e, o, p) {
    var n, i = arguments.length, r = i < 3 ? e : null === p ? p = Object.getOwnPropertyDescriptor(e, o) : p;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, p); else for (var a = t.length - 1; 0 <= a; a--) (n = t[a]) && (r = (i < 3 ? n(r) : 3 < i ? n(e, o, r) : n(e, o)) || r);
    return 3 < i && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("LoadManager"), s = e("WebManager"), c = cc._decorator, l = c.ccclass, d = c.property, u = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.sprite = null, t.box_sprite = null, t.width = 110, t.tempapp = null, t;
    }
    return i(t, e), t.prototype.start = function() {}, t.prototype.setInfo = function(t, e) {
        var o = this;
        this.tempapp = t, this.sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM, this.sprite.node.setContentSize(this.width, this.width), 
        this.loadsprite(this.tempapp), this.node.on(cc.Node.EventType.TOUCH_START, function() {
            GA.PA.navigateToMiniProgram({
                pkgName: o.tempapp.appid,
                appId: o.tempapp.appid,
                path: o.tempapp.path,
                success: function() {
                    s.default.getInstance().sentLog("点击结算界面导量"), GA.saveRedirect(e, o.tempapp.appid, o.tempapp.path);
                },
                complete: function() {
                    o.loaddata(e);
                }
            });
        });
    }, t.prototype.loaddata = function(t) {
        var e = this;
        s.default.getInstance().redirect({
            Type: t,
            CurrentAppid: this.tempapp.appid,
            CurrentPath: this.tempapp.path,
            success: function(t) {
                e && e.node && 0 == t.data.code && t.data.data && (e.tempapp = t.data.data, e.loadsprite(e.tempapp));
            }
        });
    }, t.prototype.loadsprite = function(t) {
        var e = this;
        t.icon && r.default.getInstance().load({
            url: t.icon,
            success: function(t) {
                try {
                    t instanceof cc.Texture2D ? e.sprite.spriteFrame = new cc.SpriteFrame(t) : cc.log(t);
                } catch (t) {}
            },
            fail: function(t) {
                cc.error(t);
            }
        });
    }, t.prototype.doEffect = function(t) {
        var e = this;
        this.scheduleOnce(function() {
            e.getComponentInChildren(cc.Animation).play();
        }, .3 + t % 3 * .3);
    }, t.prototype.stopEffect = function() {
        this.unscheduleAllCallbacks(), this.getComponentInChildren(cc.Animation).stop();
    }, a([ d({
        visible: !0
    }), d(cc.Sprite) ], t.prototype, "sprite", void 0), a([ d(cc.Sprite) ], t.prototype, "box_sprite", void 0), 
    a([ d ], t.prototype, "width", void 0), a([ l ], t);
}(cc.Component);

n.default = u;